// Copyright (c) 2012 The WebM project authors. All Rights Reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file in the root of the source
// tree. An additional intellectual property rights grant can be found
// in the file PATENTS.  All contributing project authors may
// be found in the AUTHORS file in the root of the source tree.

'use strict';

var WEBM_ID_NAMES_ = {
  '1A45DFA3': 'HEADER',
  '4286': 'EBMLVERSION',
  '42F7': 'EBMLREADVERSION',
  '42F2': 'EBMLMAXIDLENGTH',
  '42F3': 'EBMLMAXSIZELENGTH',
  '4282': 'DOCTYPE',
  '4287': 'DOCTYPEVERSION',
  '4285': 'DOCTYPEREADVERSION',
  'EC': 'VOID',
  'BF': 'CRC32',
  '18538067': 'SEGMENT',
  '1549A966': 'INFO',
  '1654AE6B': 'TRACKS',
  '1C53BB6B': 'CUES',
  '1254C367': 'TAGS',
  '114D9B74': 'SEEKHEAD',
  '1941A469': 'ATTACHMENTS',
  '1F43B675': 'CLUSTER',
  '1043A770': 'CHAPTERS',
  '2AD7B1': 'TIMECODESCALE',
  '4489': 'DURATION',
  '7BA9': 'TITLE',
  '5741': 'WRITINGAPP',
  '4D80': 'MUXINGAPP',
  '4461': 'DATEUTC',
  '73A4': 'SEGMENTUID',
  'AE': 'TRACKENTRY',
  'D7': 'TRACKNUMBER',
  '73C5': 'TRACKUID',
  '83': 'TRACKTYPE',
  'E1': 'TRACKAUDIO',
  'E0': 'TRACKVIDEO',
  '86': 'CODECID',
  '63A2': 'CODECPRIVATE',
  '258688': 'CODECNAME',
  '3B4040': 'CODECINFOURL',
  '26B240': 'CODECDOWNLOADURL',
  'AA': 'CODECDECODEALL',
  '536E': 'TRACKNAME',
  '22B59C': 'TRACKLANGUAGE',
  'B9': 'TRACKFLAGENABLED',
  '88': 'TRACKFLAGDEFAULT',
  '55AA': 'TRACKFLAGFORCED',
  '9C': 'TRACKFLAGLACING',
  '6DE7': 'TRACKMINCACHE',
  '6DF8': 'TRACKMAXCACHE',
  '23E383': 'TRACKDEFAULTDURATION',
  '6D80': 'TRACKCONTENTENCODINGS',
  '6240': 'TRACKCONTENTENCODING',
  '23314F': 'TRACKTIMECODESCALE',
  '55EE': 'TRACKMAXBLKADDID',
  '2383E3': 'VIDEOFRAMERATE',
  '54B0': 'VIDEODISPLAYWIDTH',
  '54BA': 'VIDEODISPLAYHEIGHT',
  'B0': 'VIDEOPIXELWIDTH',
  'BA': 'VIDEOPIXELHEIGHT',
  '54AA': 'VIDEOPIXELCROPB',
  '54BB': 'VIDEOPIXELCROPT',
  '54CC': 'VIDEOPIXELCROPL',
  '54DD': 'VIDEOPIXELCROPR',
  '54B2': 'VIDEODISPLAYUNIT',
  '9A': 'VIDEOFLAGINTERLACED',
  '53B9': 'VIDEOSTEREOMODE',
  '54B3': 'VIDEOASPECTRATIO',
  '2EB524': 'VIDEOCOLORSPACE',
  'B5': 'AUDIOSAMPLINGFREQ',
  '78B5': 'AUDIOOUTSAMPLINGFREQ',
  '6264': 'AUDIOBITDEPTH',
  '9F': 'AUDIOCHANNELS',
  '5031': 'ENCODINGORDER',
  '5032': 'ENCODINGSCOPE',
  '5033': 'ENCODINGTYPE',
  '5034': 'ENCODINGCOMPRESSION',
  '4254': 'ENCODINGCOMPALGO',
  '4255': 'ENCODINGCOMPSETTINGS',
  'BB': 'POINTENTRY',
  'B3': 'CUETIME',
  'B7': 'CUETRACKPOSITION',
  'F7': 'CUETRACK',
  'F1': 'CUECLUSTERPOSITION',
  '5378': 'CUEBLOCKNUMBER',
  '7373': 'TAG',
  '67C8': 'SIMPLETAG',
  '45A3': 'TAGNAME',
  '4487': 'TAGSTRING',
  '447A': 'TAGLANG',
  '4484': 'TAGDEFAULT',
  '44B4': 'TAGDEFAULT_BUG',
  '63C0': 'TAGTARGETS',
  '63CA': 'TAGTARGETS_TYPE',
  '68CA': 'TAGTARGETS_TYPEVALUE',
  '63C5': 'TAGTARGETS_TRACKUID',
  '63C4': 'TAGTARGETS_CHAPTERUID',
  '63C6': 'TAGTARGETS_ATTACHUID',
  '4DBB': 'SEEKENTRY',
  '53AB': 'SEEKID',
  '53AC': 'SEEKPOSITION',
  'E7': 'CLUSTERTIMECODE',
  'A7': 'CLUSTERPOSITION',
  'AB': 'CLUSTERPREVSIZE',
  'A0': 'BLOCKGROUP',
  'A3': 'SIMPLEBLOCK',
  'A1': 'BLOCK',
  '9B': 'BLOCKDURATION',
  'FB': 'BLOCKREFERENCE',
  '61A7': 'ATTACHEDFILE',
  '467E': 'FILEDESC',
  '466E': 'FILENAME',
  '4660': 'FILEMIMETYPE',
  '465C': 'FILEDATA',
  '46AE': 'FILEUID',
  '45B9': 'EDITIONENTRY',
  'B6': 'CHAPTERATOM',
  '91': 'CHAPTERTIMESTART',
  '92': 'CHAPTERTIMEEND',
  '80': 'CHAPTERDISPLAY',
  '85': 'CHAPSTRING',
  '437C': 'CHAPLANG',
  '45BC': 'EDITIONUID',
  '45BD': 'EDITIONFLAGHIDDEN',
  '45DB': 'EDITIONFLAGDEFAULT',
  '45DD': 'EDITIONFLAGORDERED',
  '73C4': 'CHAPTERUID',
  '98': 'CHAPTERFLAGHIDDEN',
  '4598': 'CHAPTERFLAGENABLED',
  '63C3': 'CHAPTERPHYSEQUIV'
};

function webmGetIdName(id) {
  var id_name_key = id.toString(16).toUpperCase();
  if (WEBM_ID_NAMES_[id_name_key]) {
    return WEBM_ID_NAMES_[id_name_key];
  }

  return 'UNKNOWN(' + id_name_key + ')';
}
